package ar.unsam.tp1.programa

import ar.unsam.tp1.programa.Condicion

class Edad extends Condicion {
	@Property int edad

	def boolean compareTo(Edad cond) {
		var int tmp = this.edad - cond.edad
		var boolean comptmp = this.admiteMayor && this.admiteMenor

		if (tmp == 0)
			true
		else {
			if (comptmp)
				true
			else {
				if (tmp < 0)
					this.admiteMayor
				else
					this.admiteMenor
			}
		}
	}

	override compararCon(Condicion cond) {
		try{
			compareTo(cond as Edad)
		}
		catch (ClassCastException e){
			false
		}
	}
}
